<#compress>
<!DOCTYPE html>
<html>
	<head>
		<title>菜单管理</title>
		<meta name="keywords" content="keyword1,keyword2,keyword3">
		<meta name="description" content="this is my page">
		<meta name="content-type" content="text/html; charset=UTF-8">
		<base href="${webroot}">
		<#include "../../template/easyui.ftl" parse="true" encoding="UTF-8">
	</head>
	<body>
		<div class="easyui-layout" data-options="fit:true">
			<input id="current_system" type="hidden" value="${current_system}" />
			<div data-options="region:'west',split:true,border:false" style="width:18%;">
            	<ul class="easyui-tree" id="actiontree" style="padding-top: 10px;"
								data-options="
									<#-- url: 'action/menu_native_tree.tree', -->
									method: 'get',
									lines: true,
									loadFilter: ActionTreeConvert,
									onSelect: module.onSelectTree,
									onLoadSuccess: module.onLoadSuccessTree
							"></ul>
            </div>
			<div data-options="region:'center',border:false">
				<table class="easyui-datagrid" title="" id="actiongrid"
				  		 data-options="
				  		 	striped:true,
				  			border:false,
				  		 	url: 'action/menu_list.grid?current_system=${current_system}',
				  		 	method: 'get',
				  		 	pageSize:20,
				  		 	rownumbers: true,
				  		 	pagination: true,
				  		 	fit: true,
				  		 	toolbar: '#tb',
				  		 	onDblClickRow: module.onDblClickRow,
				  		 	rowStyler:dataRowFormat
				  		 ">
					<thead>
						<tr>
							<th data-options="field:'id',width:50,checkbox:true">ID</th>
							<th data-options="field:'text',width:150,formatter:TypeformatImg">名称</th>
							<th data-options="field:'a_url',width:220,
								formatter:function(value, row, index) {
									return Common.Util.formatter(value);
								}">URL</th>
							<th data-options="field:'a_href',width:300,
								formatter:function(value, row, index) {
									return Common.Util.formatter(value);
								}">链接</th>
							<th data-options="field:'a_loging',align:'center',width:85,formatter:formatLog">日志记录</th> 
							<th data-options="field:'a_status',align:'center',width:85,
								formatter:function(value, row, index) {
									return value == 1 ? '正常' : '禁用';
								}">资源状态</th>
							<th data-options="field:'a_control',align:'center',width:85,
								formatter:controlFormat">隔离级别</th>
							<th data-options="field:'a_sort',align:'center',width:70">排序号</th>
							<th data-options="field:'c_name',align:'center',width:80">所属系统</th>
							<th data-options="field:'a_icon',width:200,
								formatter:function(value, row, index) {
									return Common.Util.formatter(value);
								}">图标</th>
						</tr>
					</thead>
				</table>
				<div id="tb" style="padding:5px;height:auto">
					<div style="margin-bottom:5px">
						关键字:
						<input id="actionname" class="easyui-textbox" data-options="prompt:'输入关键字进行查询'" style="width:140px;">
						URL:
						<input id="actionurl" class="easyui-textbox" data-options="prompt:'输入关键字进行查询'" style="width:140px;">
						<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search" onclick="module.queryDatagrid();">查询</a>
						<a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-reload" onclick="module.refreshDatagrid();">刷新</a>
						<br>
						<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-load" onclick="module.expandTree();">展开</a>
						<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-load" onclick="module.collapseTree();">收缩</a>
						${新增!""}${修改!""}${启用!""}${禁用!""}${删除!""}
						<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" action="add" onclick="module.openDialog();">新增</a>
						<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-edit" action="modify" onclick="module.modify();">修改</a>
						<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-no" action="deleted" onclick="deleteMenu();">删除</a>
					</div>
				</div>
			</div>

			<div id="adialog" class="easyui-dialog" title="编辑"
				style="width:580px;height:510px;"
				data-options="resizable:true,modal:true,buttons:'#dlg-buttons',closed:true">
				<form name="afrom" id="afrom" method="post">
					<ul >
						<li >
							<label>菜单名称:</label>
							<div>
								<input name="AName" id="AName" class="easyui-textbox" style="width:490px"
									data-options="required:true" />
							</div>
						</li>
						<li >
							<label>上级菜单:</label>
							<div>
								<input name="AParentid" id="AParentid" class="easyui-combotree" style="width:490px"
									data-options="
										<#--url: 'action/action_native_tree.tree',-->
										method: 'get',
										lines: true,
										required : true,
										loadFilter: convertTreeAppendRoot"
									/>
							</div>
						</li>
						<li >
							<label>URL:</label>
							<div>
								<input name="AUrl" id="AUrl" class="easyui-textbox" style="width:490px"/>
							</div>
						</li>
						<li >
							<label>链接:</label>
							<div>
								<input name="AHref" id="AHref" class="easyui-textbox" style="width:490px"/>
							</div>
						</li>
						<li>
							<label>日志记录:</label>
							<div>
								<select name="ALoging" id="ALoging" class="easyui-combobox" style="width:490px"
									data-options="required:true,editable:false,panelHeight:'auto'">
									<option value='0' selected>否</option>
									<option value='1'>是</option>
								</select>
							</div>
						</li>
						<li>
							<label>隔离级别:</label>
							<div>
								<select name="AControl" id="AControl" class="easyui-combobox" style="width:490px"
									data-options="required:true,editable:false,panelHeight:'auto'">
									<option value='0' selected>白名单</option>
									<option value='1'>黑名单</option>
									<option value='2'>登录可见</option>
								</select>
							</div>
						</li>
						<li >
							<label>排序号:</label>
							<div>
								<input name="ASort" id="ASort" class="easyui-numberbox"	data-options="min:-100,max:9999,precision:0" style="width:490px" /> 
							</div>
						</li>
						<li>
							<label>所属系统:</label>
							<div>
								<select name="ASystem" id="ASystem" class="easyui-combobox" style="width:490px" editable="false"
									data-options="
										valueField:'id',textField:'c_value',
										url: 'const/getcode.tree?pid=27',
										method: 'get',
										required : true,
										lines: true">
								</select>
							</div>
						</li>
						<li>
							<label>图标:</label>
							<div>
								<!-- <select class="easyui-combobox" id="AIcon" name="AIcon"   style="width:490px"
								data-options="    
							        valueField: 'id',   
							        textField: 'text',
							        url: 'action/menuIcons.do'" 
								 />  -->
								 <input name="AIcon" id="AIcon" class="easyui-textbox" style="width:490px"/>	
							</div>
						</li>
					</ul>
					<input type="hidden" value="2" name="AType" id="AType">
					<input type="hidden" name="id" value="" />
				</form>
			</div>
			<div id="dlg-buttons">
				<a href="javascript:void(0);" class="easyui-linkbutton" onclick="module.edit()">保存</a>
				<a href="javascript:void(0);" class="easyui-linkbutton" onclick="module.closeDialog()">取消</a>
			</div>
		</div>
</div>
	</body>
	<script type="text/javascript" src="res/rbac/menu.js"></script>
	<script type="text/javascript" src="res/rbac/action_tree_convert.js"></script>
	<script type="text/javascript">
		function formatLog(value, row, index){
			if(row.a_type==1||row.a_url==""){return "--";}
			else{
				return value ?"<img src=\"res/img/ok.png\"/>":"<img src=\"res/img/cross.png\"/>";
			}
		}
		
		function TypeformatImg(value, row, index){
			if(row.a_type==0){
				return "<img src=\"res/img/link.png\"/> "+value;
			}else if(row.a_type==1){
				return "<img src=\"res/img/html.png\"/> "+value;
			}else if(row.a_type==2){
				return "<img src=\"res/img/folder.png\"/> "+value;
			}else if(row.a_type==3){
				return "<img src=\"res/img/box.png\"/> "+value;
			}
		}
		function controlFormat(value, row, index) {
			if(0==value){
				return "<img src=\"res/img/ok.png\" title='白名单'/> ";
			}else if(1==value){
				return "<img src=\"res/img/lockicon.png\" title='黑名单'/> ";
			}else if(2==value){
				return "<img src=\"res/img/user_go.png\" title='登录可见'/>";
			}
		}
		function AtSelect(record){
			switch(record.value){
			case 0:
				$("#AHref").textbox("disable",true);
				$("#AHref").attr({ "disabled": "disabled" });
				break;
				
			}
		}
	</script>
</html>
</#compress>
